#include<iostream>
const int N = 1e6 + 10;
typedef long long ll;
ll a[N];
using namespace std;
int main()
{
	int n,m;cin >> n >>m;
	for (int i = 1; i <= n; i++)
	{
		cin >> a[i];
	}
	while (m--)
	{
		ll x;cin >> x;
		ll left = 1, right = n;
		while (left < right)
		{
			ll mid = (right + left) / 2;
			if (a[mid] >= x) right = mid;
			else left = mid + 1;
		}
		if (a[left] == x) cout << left << " ";
		else cout << "-1" << ' ';
	}
	return 0;
}